package com.vogue.supplymall.shop.domain.mapper;

import com.vogue.ssm.database.util.SqlLangDriver;
import com.vogue.supplymall.shop.domain.model.ProductDetails;

import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * The interface Product details mapper.
 *
 * @aouthor: zhangliang
 * @date: Create in 2018-01-02
 */
@Mapper
public interface ProductDetailsMapper extends BaseMapper<ProductDetails, Long> {

    /**
     * Gets product deta.
     * 获取商品详情信息
     *
     * @param productDetails the product details
     * @return the product deta
     */
    @Select("select pd.id,pd.productid,pd.`name`,pd.val,pd.type,pd.seqnum " +
            "from product_details pd,product p " +
            "where p.id = #{productid} and p.id = pd.productid and type = #{type} ORDER BY seqnum asc")
    @Lang(SqlLangDriver.class)
    List<ProductDetails> getProductDeta(ProductDetails productDetails);
    /**
     * 根据syscodeid、productid得到商品详情信息
     */
    @Select("select * from product_details where syscodeid=#{arg0} and productid=#{arg1}")
    @Lang(SqlLangDriver.class)
    public List<ProductDetails> findProductDetailsBySP(Long syscodeid,Long productid);
}
